﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;

namespace AVAilableRooms.Services
{

    //public class SilverlightFaultBehavior : BehaviorExtensionElement, IEndpointBehavior
    //{
    //    public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
    //    {
    //        SilverlightFaultMessageInspector inspector = new SilverlightFaultMessageInspector();
    //        endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
    //    }
    //    public class SilverlightFaultMessageInspector : IDispatchMessageInspector
    //    {
    //        public void BeforeSendReply(ref Message reply, object correlationState)
    //        {
    //            if (reply.IsFault)
    //            {
    //                HttpResponseMessageProperty property = new HttpResponseMessageProperty();

    //                // Here the response code is changed to 200.
    //                property.StatusCode = System.Net.HttpStatusCode.OK;

    //                reply.Properties[HttpResponseMessageProperty.Name] = property;
    //            }
    //        }

    //        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
    //        {
    //            // Do nothing to the incoming message.
    //            return null;
    //        }
    //    }

    //    // The following methods are stubs and not relevant. 
    //    public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
    //    {
    //    }

    //    public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
    //    {
    //    }

    //    public void Validate(ServiceEndpoint endpoint)
    //    {
    //    }

    //    public override System.Type BehaviorType
    //    {
    //        get { return typeof(SilverlightFaultBehavior); }
    //    }

    //    protected override object CreateBehavior()
    //    {
    //        return new SilverlightFaultBehavior();
    //    }

    //}
}
